<?php

function log_error($num, $str, $file, $line, $context = null)
{
    echo 'err', $str;
}

function log_exception($num, $str, $file, $line, $context = null)
{
    echo 'exception', $str;
}

set_error_handler("log_error");
set_exception_handler("log_exception");

try {
   trigger_error(1);
   echo 123;
   echo 456;
} catch (\Exception $th) {
    echo $th->getMessage();
}
